<template>
	<div>
	<el-table :data="tableData" border style="width: 100%">
		<el-table-column prop="s_name" label="名字" width="180"></el-table-column>
		<el-table-column prop="s_city" label="城市" width="180"></el-table-column>
		<el-table-column prop="s_num" label="编号"></el-table-column>
	</el-table>
	<el-pagination
	  background
	  layout="prev, pager, next"
	  :total="total"
	  :page-size="pageSize"
	  @current-change="getNow">
	</el-pagination>
	</div>
</template>

<script>
export default {
	data() {
		return {
			tableData: [],
			total:1,
			pageSize:2,
			pageNow:1
		};
	},
	created() {
		this.getPage();
	},
	methods:{
		getNow:function(a){
			this.pageNow=a;
			this.getPage();
		},
		getPage: function() {
			var _this=this;
			_this.$ajax
				.get('http://www.exam03.com/ca', {
					params: {
						page:_this.pageNow
					}
				})
				.then(function(response) {
					_this.tableData=response.data.data.data
					_this.total=response.data.data.total
					// _this.pageSize=response.data.data.pageSize
				})
				.catch(function(error) {
					console.log(error);
				});
		}
	}
	
};
</script>
